Repository navigation
ZeroTier page under Settings → VPN - #989
Conversation
Install, start, stop and remove the add-on, join and leave networks, and report the node, its networks and their addresses from zerotier-cli's JSON (stdout only, so a warning on stderr cannot break the parse). The identity and joined networks are in the settings backup for restoring this device, never for migration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dormancygrace
left a comment
There was a problem hiding this comment.
Requested changes after reviewing the package lifecycle, restore policy and settings page. A temporary-root Go check confirmed deletion of an existing identity in the restore plan for a legacy same-device backup. Focused Go tests and vet, the production web build and lint passed; the GitHub checks for this head also passed. The restore compatibility and service lifecycle issues need fixes before merge.
A backup now lists the settings groups it covers (ZeroTier, the first). Restoring one made before a group existed leaves that group's files as they are, in the plan and in the boot pass that takes inventory again, instead of deleting the identity and networks it never recorded. A backup that covers ZeroTier still restores its recorded state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…level failures Uninstall stops ZeroTier inside apkpkg.RemoveAfter, under the package lock: while another update holds it, ZeroTier keeps running and stays in the boot runlevel. If apk then fails, it is started again and put back in the runlevel as it was. Stop treats a service already out of the runlevel as success and reports a failure to take it out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A poll tick is skipped while a request is on its way, so slow answers are no longer dropped by the next tick; a refresh after an action reads once more after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dormancygrace
left a comment
There was a problem hiding this comment.
Verified and resolved the four earlier findings on this revision: importing an old backup with the new code preserves the identity, package lock contention now precedes service shutdown, Stop propagates runlevel failures, and slow status polls coalesce. Two additional paths still risk losing a working ZeroTier identity or connection. Both are detailed inline with isolated reproductions. Focused Go tests and vet, web build and lint, a slow-response polling check, and all applicable CI jobs passed.
Plan.Covers replaces Plan.Keep: the groups a plan may change (the archive's, or all for a reset). A journal without it, as one a release before groups queued, changes no group's files, in the plan or in the boot pass, so a restore staged before an upgrade keeps the ZeroTier identity and networks written before its replay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RemoveAfter simulates the removal under the lock first and refuses before prepare when apk would keep a package (apk del exits 0 and keeps one another selected package needs), then checks after apk del that the packages are gone, undoing prepare otherwise. ZeroTier's purge runs only after that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dormancygrace
left a comment
There was a problem hiding this comment.
Requesting changes for two paths that can still delete the ZeroTier identity. The legacy restore regression is fixed. The removal simulation also correctly rejects a pre-existing reverse dependency before stopping the service. Local race tests and vet passed, along with GitHub CI, CodeQL, the add-on build and the firmware build. The inline findings cover a legacy factory-reset journal and an indeterminate post-removal check.
The boot pass prepares a queued reset again, which covered every group this release knows. A reset queued by a release before groups existed then deleted the ZeroTier identity that its own boot pass would have kept. Keep the journal's coverage and drop regenerated changes outside it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The check after apk del took any failure of apk info -e, also a failed exec or database read, as proof that the package was gone, so a purge could erase the identity of a node still installed. Read the installed database instead; an unreadable or empty one fails the removal and runs the caller's undo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ServiceRunning ran rc-service without a time limit, so a stuck OpenRC held every status request. Run it like the other commands, with the command timeout and a kill of its process group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A backup taken before ZeroTier ran covered its group anyway, so restoring it deleted an identity made later, which no backup holds. Cover a group only when the device has files of it. A group of a later release now asks for that release instead of failing as invalid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A running service without a node ID has not answered yet: its networks are unknown, not none, so say so and keep Join disabled. Drop the 16-character limit on the network ID field, which cut a pasted ID with surrounding spaces before the trim. Guard a missing error object in the uninstall modal. VPN.md: installing does not start ZeroTier. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Besides the two inline fixes, I went over the whole PR again before pushing. That added three small commits you didn't ask for, so here's what they change:
Go vet, the race tests of the touched packages, the full Go suite, the web build and lint, and the test budget all pass locally. The one exception is the remotemedia SMB test, which can't run under WSL. |
dormancygrace
left a comment
There was a problem hiding this comment.
Verified the legacy reset fix and the removal helper’s handling of a failed installed-database read and a retained package. Two paths still erase identity state: restoring a backup containing only pre-start configuration, and purging a recorded installation whose binary is missing. Both were reproduced against this revision in isolated roots. Race tests and vet passed for recovery, osupdate, apkpkg and zerotier; CI, CodeQL and both builds passed.
A backup taken before ZeroTier first started, with only local.conf or a preseeded network, covered the whole group, so restoring it deleted the identity and networks made since. Split the group: the identity and its networks are covered only when identity.secret was backed up, and their files stay out otherwise; local.conf is covered when it was backed up or once ZeroTier had started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Uninstall took a missing binary for an absent package and purged the state without the update lock. RemoveAfter now reads the installed database under the lock: a recorded package is removed even with its files missing, and the purge runs under the same lock once the package is gone or was never recorded, never while a ZeroTier from elsewhere is still there. A recorded package without its program shows as installed and not running, so the page offers Uninstall, and Start and Install say how to repair it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dormancygrace
left a comment
There was a problem hiding this comment.
Verified both fixes on ef7a920. A pre-start configuration backup restores local.conf and preserves the later node identity and memberships. In an isolated filesystem with a recorded package and missing executable, a held update lock or failed APK operation now leaves the identity intact. Explicit purge succeeded after confirming package absence. The full server suite passed, with race tests and vet on the four affected packages. Web UI, CodeQL, firmware and add-on CI also passed.
Refs #981. This is the second half, after the package in #985: a ZeroTier page under Settings → VPN, next to Tailscale and NetBird.
What it does
nanokvm-zerotierfrom the add-on repository the same way the OCR models are installed (apkpkg.InstallOnly), so an install that would upgrade, downgrade or remove another package is refused.zerotier-oneto the default runlevel and starts it; Stop does the reverse. The daemon is started without the server's OOM protection.zerotier-cli -j infoand-j listnetworks, stdout only, so a warning on stderr can't break the parse. The page polls every 5 s while visible.^[0-9a-f]{16}$before anything reacheszerotier-cli. A network that still needs authorization shows Not authorized./var/lib/zerotier-one(identity and networks) is kept unless you choose to delete it.zerotier-oneis an optional service in Diagnostics.zerotier-one -v.identity.secret,identity.public,local.confandnetworks.d/are in the settings backup for Restore this device. They're never copied by migration, because two devices with one identity break each other.authtoken.secret, peers and the planet file aren't settings and stay out.The page uses a generic lucide icon, not ZeroTier's logo. Only
en.jsonhas the new strings, and the other languages fall back to English until Weblate catches up.How I checked it
Go: build, vet and tests with
teststub,nomsgpack. The only failure is the remotemedia SMB test, which fails the same way without these changes, because memfd isn't available under WSL.New Go tests: the network ID check, the JSON parsers, the IPv4 pick, and the backup policy for the ZeroTier paths.
Web:
format:check,build,lintand the web tests (37 pass).On a NanoKVM Lite with the nanokvm-zerotier: ZeroTier One 1.16.2 as an optional add-on #985 package:
zerotier-cli -j infoand-j listnetworksparses correctly with these parsers.The page on the device: NanoKVM OS 4.2.1 with this PR's server and web commits on top, built against the device's own
libkvm/libkvm_mmf, and driven in a browser:/var/lib/zerotier-one. Install (from a temporary signed local repository, since the add-on isn't on Pages yet), then Start, comes back with the same node ID and network.zerotier-oneas an optional running service.apk del, a second Stop, and the poll under 6.5 s latency (details in the review replies).Afterwards the device went back to the stock 4.2.1 server and web files.